package com.dmpp.mes.controller;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.parameterInfo.Aroma;
import com.dmpp.mes.parameterInfo.MaterialType;
import com.dmpp.mes.service.AromaService;
import com.dmpp.mes.service.MaterialTypeService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("MaterialType")
public class MaterielTypeController {
//物料类型
    @Autowired
    private MaterialTypeService service;


    @RequestMapping(value = "/FindAll", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findAll(Integer page, Integer pageSize,MaterialType materialType) {
        PageHelper.startPage(page, pageSize);
        return service.findAll(materialType);
    }

    @RequestMapping(value = "/FindById", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findById(String id) {
        return service.findById(id);
    }

    @RequestMapping(value = "/Insert", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData insert(MaterialType materialType) {
        return service.insert(materialType);
    }

    @RequestMapping(value = "/UpdateById", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateByCode(MaterialType materialType) {
        return service.updateById(materialType);
    }

    @RequestMapping(value = "/Delete", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData delete(String id) {
        return service.delete(id);
    }

}
